package com.cskaoyan.dbutils.handlerDemo;

import com.cskaoyan.connectionpool.DruidUtils;
import com.cskaoyan.dbutils.bean.Account;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/**
 * 创建日期: 2022/04/23 11:29
 *
 * @author ciggar
 */
public class BeanHandlerDemo {

    public static void main(String[] args) throws SQLException {

        // 创建一个QueryRUnner对象
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        Account account = queryRunner.query("select * from account where id = ?",new BeanHandler<>(Account.class),11);

        System.out.println(account);


    }
}
